package com.ruoyi.web.controller.example;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@Anonymous
@RestController
public class BindController extends BaseController{
    @RequestMapping("/getUserId")
    public void getUserId(HttpServletRequest request){
        String userId = request.getParameter("userId");
        String name = request.getParameter("name");
        System.out.println("用户的id是：" +userId);
    }
   @GetMapping("/getUserName")
    public  String getUserName(@RequestParam(value = "name",required = true
    ,defaultValue = "默认的名字-梁家琦")String username){
        System.out.println("用户的名称是："+username);
        return username;
    }

    @GetMapping("/getUserName2")
    public String getUserName2(@PathVariable(
            value = "name")String username){
        return "获取到的用户名称是：" + username;
    }
}

